<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../core/include.inc.jsp"%>

<style>
  .moreInfo{width:32%;height:100px;background: rgba(0,0,0,0.5);color:#fff;position:absolute;overflow: auto;z-index: 999;left:500px;
  }
</style>
<script type="text/javascript">
  //重置
//  $(".consultation-list-reset-button").click(function(){
//    $(".consultation-list-div select[name='blockId']").val("-1");
//    $(".consultation_list_page_form input[name='blockId']").val("");
//    $(".consultation-list-div select[name='status']").val("-1");
//    $(".consultation_list_page_form input[name='status']").val("");
//    $(".consultation_list_page_form").submit();
//  })
  //查询
  $(".consultation-list-search-button").click(function(){
    var blockId = $(".consultation-list-div select[name='blockId']").val();
    $(".consultation_list_page_form input[name='blockId']").val(blockId);
    var status = $(".consultation-list-div select[name='status']").val();
    $(".consultation_list_page_form input[name='status']").val(status);
    $(".consultation_list_page_form").submit();
  });

  function checkReply(){
    var m = "";
    $(".consultation-tb-body").find("tr").each(function(i,j){
      if( $(j).hasClass( "selected" ) ){
        m += "1";
        if( $(j).attr("conStatus") == 1 ){
          alertMsg.info('您已经回复过了！');
          return;
        }
        $(".reply-consultation").click();
        return;
      }
    })
    if( m == ""  ){
      alertMsg.info('请选择一条记录！');
    }
  }
</script>
<%--表单区域--%>
<form id="pagerForm" onsubmit="return navTabSearch(this);" method="post" action="community_consultation_list" class="consultation_list_page_form">
  <input type="hidden" name="pageNum" value="${pageModel.pageNum}" />
  <input type="hidden" name="numPerPage" value="${pageModel.numPerPage}" />
  <input type="hidden" name="blockId" value="${blockId}" />
  <input type="hidden" name="status" value="${status}" />
</form>
<div class="moreInfo show-more" style="display:none" rel="-1">
  <p></p>
</div>
<div class="pageHeader">
  <div class="searchBar">
    <ul class="searchContent consultation-list-div">
      小区名称
      <select name="blockId">
        <option value="-1">--选择小区--</option>
        <c:forEach var="block" items="${blocks}">
          <option value="${block.id}" <c:if test="${block.id == blockId }">selected="selected" </c:if> >${block.blockName}</option>
        </c:forEach>
      </select>
      &nbsp;&nbsp;
      <select name="status" class="textInput">
        <option value="-1">--请选择--</option>
        <option value="0" <c:if test="${status==0}">selected</c:if>>待回复</option>
        <option value="1" <c:if test="${status==1}">selected</c:if>>已回复</option>
      </select>
      &nbsp;&nbsp;
      <input type="button" value="查询" class="consultation-list-search-button" />
      <%--&nbsp;&nbsp;--%>
      <%--<input type="button" value="重置" class="consultation-list-reset-button" />--%>
    </ul>
  </div>
</div>
<div class="pageContent">
  <div class="panelBar">
    <ul class="toolBar">
      <li>
        <div style="display: none;">
          <a class="add reply-consultation" href="to_reply_community_consultation?id={consultation_id}" target="dialog" width="420" height="400" mask="true" title="回复">
            <span>回复</span>
          </a>
        </div>
        <a class="add" onclick="checkReply();">
          <span>回复</span>
        </a>
      </li>
      <li class="line">line</li>
      <li>
        <a class="edit" href="to_detail_community_consultation?id={consultation_id}" target="dialog" width="420" height="600" mask="true">
          <span>查看详情</span>
        </a>
      </li>
      <li class="line">line</li>
      <li>
        <a class="delete" href="to_add_remark_community_consultation?id={consultation_id}" target="dialog">
          <span>添加备注</span>
        </a>
      </li>
      <li class="line">line</li>
    </ul>
  </div>
  <table class="table" width="100%" layoutH="86">
    <thead>
    <tr>
      <th>序号</th>
      <th>小区名称</th>
      <th>用户账号</th>
      <th>咨询内容</th>
      <th>状态</th>
      <th>创建时间</th>
    </tr>
    </thead>
    <tbody class="consultation-tb-body">
    <c:forEach var="consultation" items="${consultations}" varStatus="st">
      <tr target="consultation_id" rel="${consultation.id}" need="${consultation.askIngContent}" class="show-more" conStatus="${consultation.status}">
        <td>${st.index+1}</td>
        <td>${consultation.blockName}</td>
        <td>${consultation.nickname}</td>
        <td>${consultation.showAskIngContent}</td>
        <td>
          <c:if test="${consultation.status == 0}">
            待回复
          </c:if>
          <c:if test="${consultation.status == 1}">
            已回复
          </c:if>
        </td>
        <td>
          <fmt:formatDate value="${consultation.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
        </td>
      </tr>
    </c:forEach>
    </tbody>
  </table>
  <c:import url="../../core/pagebar.inc.jsp" />
</div>



